/*
 * @Author: DUST
 * @Date: 2023-06-20 09:29:54
 * @LastEditors: DUST
 * @LastEditTime: 2023-06-20 09:41:55
 * @FilePath: \national-standard-platform-alarm-screen\src\utils\ckThree\light.js
 * @Description: 
 * undefined
 */
import { AmbientLight, DirectionalLight } from "three";
/**
 * @description: 初始化灯光
 * @param {*} scene：场景对象
 */
const initLight = (scene) => {
  const ambientLight = new AmbientLight(0x999999);
  scene.add(ambientLight);

  const dlight = new DirectionalLight(0xffffff);
  dlight.position.set(30, 50, 100);
  dlight.position.multiplyScalar(1.3);
  dlight.castShadow = true;
  dlight.shadow.mapSize.width = 2048;
  dlight.shadow.mapSize.height = 2048;
  const d = 200;
  dlight.shadow.camera.left = -d;
  dlight.shadow.camera.right = d;
  dlight.shadow.camera.top = d;
  dlight.shadow.camera.bottom = -d;
  dlight.shadow.camera.near = 1;
  dlight.shadow.camera.far = 500;
  dlight.lookAt(0, 0, 0);
  scene.add(dlight);

  return {
    dlight,
    ambientLight
  }
}

export default initLight;